let checkInclusion = function(s1, s2){
    // 求S1的所有排列
    let len1 = s1.length
    let len2 = s2.length

    function charIsEqu(s11, s22){
        let arr1 = new Array(26).fill(0)
        let arr2 = new Array(26).fill(0)
        for(let i=0; i<len1; i++){
            arr1[s11.charCodeAt(i) - 'a'.charCodeAt(0)] = 1
            arr2[s22.charCodeAt(i) - 'a'.charCodeAt(0)] = 1
        }
        if(arr1.toString() === arr2.toString()){
            return true
        }
        return false
    }
    
    for(let i=0; i<len2-len1; i++){
        if(charIsEqu(s1,s2.substr(i, len1))){
            return true
        }
    }
    return false
}


let s1 = "ab", s2 = "eidbaooo"
checkInclusion(s1, s2)



